﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class frmTipoIngrediente : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = "";

    }
    protected void TextBox6_TextChanged(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        SqlDataSource1.InsertParameters["descripcion"].DefaultValue = TextBox1.Text.ToString();
        SqlDataSource1.InsertParameters["composicionQuimica"].DefaultValue = TextBox2.Text.ToString().ToUpper();
        SqlDataSource1.InsertParameters["aspecto"].DefaultValue = TextBox3.Text.ToString();
        SqlDataSource1.InsertParameters["presentacion"].DefaultValue = TextBox4.Text.ToString();
        SqlDataSource1.InsertParameters["nroIns"].DefaultValue = TextBox10.Text.ToString();   
        SqlDataSource1.InsertParameters["caracteresOrganolepticos"].DefaultValue = TextBox7.Text.ToString();
        SqlDataSource1.InsertParameters["denominacionLegal"].DefaultValue = TextBox8.Text.ToString();
        SqlDataSource1.InsertParameters["tipoDeIngrediente"].DefaultValue = "";
        
        //------------------------------------------------------------------------------------------------------
        SqlDataSource1.InsertParameters["estadoConservacion"].DefaultValue = DropDownList3.SelectedValue.ToString();
        SqlDataSource1.InsertParameters["zonaComercializacion"].DefaultValue = DropDownList2.SelectedValue.ToString();
        SqlDataSource1.InsertParameters["tipoDeIngrediente"].DefaultValue = DropDownList1.SelectedValue.ToString();
        SqlDataSource1.InsertParameters["calidad"].DefaultValue = DropDownList4.SelectedValue.ToString();

        SqlDataSource1.Insert();

        Label1.Text = "Producto registrado correctamente!";

        TextBox1.Enabled = false;
        TextBox2.Enabled = false;
        TextBox3.Enabled = false;
        TextBox4.Enabled = false;
        DropDownList4.Enabled = false;
        DropDownList3.Enabled = false;
        TextBox7.Enabled = false;
        TextBox8.Enabled = false;
        DropDownList2.Enabled = false;
        DropDownList1.Enabled = false;
        TextBox10.Enabled = false;
        Button1.Enabled = false;


    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "";

        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox7.Text = "";
        TextBox8.Text = "";

        DropDownList1.SelectedIndex = 1;
        DropDownList4.SelectedIndex = 1;
        DropDownList3.SelectedIndex = 1;
        DropDownList2.SelectedIndex = 1;
        TextBox10.Text = "No posee";

        
        Response.Redirect("frmTipoIngrediente.aspx");
    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
    
         //   TextBox7.Visible=false;
        

    }
}